package com.ruoyi.work.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author: MMDZ
 * @Desc:
 */
@AllArgsConstructor
@Getter
public enum CheckType {
    Rollback(2, "回退"),
    Waiting(0, "待审核"),
    Checked(1, "已审核");

    private final Integer code;
    private final String info;

    public static String get(Integer v) {
        if (v == null) {
            return CheckType.Waiting.info;
        }
        CheckType type = Arrays.asList(CheckType.values()).stream().filter(e -> e.code == v).findFirst().orElse(null);
        return Objects.nonNull(type) ? type.info : CheckType.Waiting.info;
    }
}
